import java.util.Scanner;

public class Main1153 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int[] num = new int[m];
        for (int i = 0; i < m; i++) {
            num[i] = sc.nextInt();
        }
        for (int i=1;i<m-1;i++){
            if (num[i]>num[i-1]&&num[i]> num[i+1]){
                System.out.println(num[i]);
            }
        }
    }
}